package com.interview.spring.aop.app;

import com.interview.spring.aop.dao.UserDaoImpl;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import static com.interview.spring.aop.dao.UserDaoImpl.aa;

/**
 * @author: zsg
 * @description:
 * @date: 2019/11/23 19:00
 * @modified:
 */
@Component
@Scope("prototype")
@Aspect("pertarget(target(com.interview.spring.aop.dao.UserDaoImpl))")
public class TestPerthisAspectj {

    @Around("target(com.interview.spring.aop.dao.UserDaoImpl)")
    public Object  recordServiceUsage(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("this is before around advice");
        Object result = pjp.proceed();
        System.out.println("this is after around advice");
        return result;
    }

}
